#include "file.h"
#include <fstream>
#include <boost\filesystem.hpp>

using namespace std;
namespace bfs2 = boost::filesystem2;

File::File()
{
	uID = 0;
	strPath = "chkf";
}

File::File(std::string f, unsigned id)
{
	if(!bfs2::exists(bfs2::path(f.c_str())))
	{
		id = 0;
		strPath = "";
		return;
	}

	this->uID = id;
	this->strPath = f;

	fstream file(f.c_str(), ios::in);

	string tmp;
	while(!file.eof())
	{
		getline(file, tmp);
		_Lines.push_back(tmp);
	}

	file.close();
}

File::File(const File& f)
{
	uID = f.GetID();
	this->strPath = f.GetPath();
	for(int i = 0; i < f.GetLinesCount(); i++)
		this->_Lines.push_back(f.GetLine(i));
}
	